package org.springblade.modules.notice.core.receiver;

import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author ysq
 * @Date 2024/11/21
 * @Description 推送对象策略工厂
 */
@Component
public class PushObjectFactory {

	private final Map<Integer, PushObjectHandler> pushStrategy = new HashMap<>(8);

	public void register(Integer pushObjectCode, PushObjectHandler handler) {
		pushStrategy.put(pushObjectCode, handler);
	}

	public PushObjectHandler getHandler(Integer pushObjectCode) {
		return pushStrategy.get(pushObjectCode);
	}
}
